import Vue from 'vue'
import Router from 'vue-router'
const HomePage = () => import('../views/homePage/HomePage')
const Find = () => import('../views/find/Find')
const Bookrack = () => import('../views/bookrack/Bookrack')
const Profile = () => import('../views/profile/Profile')
const Login = () => import('../views/login/Login')

const Recommend = () => import('../views/homePage/homePageItem/Recommend')
const Hot = () => import('../views/homePage/homePageItem/Hot')
const Ranking = () => import('../views/homePage/homePageItem/Ranking')
const PositiveEnergy = () => import('../views/homePage/homePageItem/PositiveEnergy')

const Classify = () => import('../views/find/findItem/Classify')
const Free = () => import('../views/find/findItem/Free')
const Villain = () => import('../views/find/findItem/Villain')
const Original = () => import('../views/find/findItem/Original')

const Detail = () => import('../views/detail/Detail')

const Search = () => import('../views/search/Search')

const Collect = () => import('../views/bookrack/bookrackItem/Collect')
const History = () => import('../views/bookrack/bookrackItem/History')
const Cache = () => import('../views/bookrack/bookrackItem/Cache')
Vue.use(Router)


export default new Router({
  mode:'history',
  routes: [
    {
      path: '/search',
      name: 'Search',
      component:Search,
      meta:{
        showTab:true
      }
    },
    {
      path: '/detail',
      name: 'Detail',
      component:Detail,
      meta:{
        showTab:true
      }
    },
    {
      path: '/',
      redirect:'/homePage/recommend'
    },
    {
      path: '/homePage',           //首页
      name: 'HomePage',
      component:HomePage,
      meta:{index:0},
      children:[
        {
          path: 'recommend',
          name: 'Recommend',
          component:Recommend,
          meta:{index:1}
        },
        {
          path: 'hot',
          name: 'Hot',
          component:Hot,
          meta:{index:2}
        },
        {
          path: 'ranking',
          name: 'Ranking',
          component:Ranking,
          meta:{index:3}
        },
        {
          path: 'positiveEnergy',
          name: 'PositiveEnergy',
          component:PositiveEnergy,
          meta:{index:4}
        }
      ]
    },
    {
      path: '/find',      //发现页
      name: 'Find',
      component:Find,
      meta:{index:5},
      children:[
        {
          path: 'classify',
          name: 'Classify',
          component:Classify,
          meta:{index:6}
        },
        {
          path: 'free',
          name: 'Free',
          component:Free,
          meta:{index:7}
        },
        {
          path: 'villain',
          name: 'Villain',
          component:Villain,
          meta:{index:8}
        },
        {
          path: 'original',
          name: 'Original',
          component:Original,
          meta:{index:9}
        }
      ]
    },
    {
      path: '/bookrack',  //书架页
      name: 'Bookrack',
      component:Bookrack,
      meta:{index:10},
      children:[
        {
          path: 'collect',
          name: 'Collect',
          component:Collect,
          meta:{index:11}
        },
        {
          path: 'history',
          name: 'History',
          component:History,
          meta:{index:12}
        },
        {
          path: 'cache',
          name: 'Cache',
          component:Cache,
          meta:{index:13}
        }
      ]
    },
    {
      path: '/profile',   //我的页
      name: 'Profile',
      component:Profile,
      meta:{index:14}
    },
    {
      path: '/login',   //登录页
      name: 'Login',
      component:Login,
      meta:{
        showTab:true,
      }
    }
  ]
})

